<template>
<div class="vip-list views-container">
    <div class="wlm-table">
        <div class="wlm-table-hearder-btn">
            <router-link tag="span" to="/channel/weChatMenuChannelAdd">
                <el-button size="small" type="primary">添加菜单</el-button>
            </router-link>
        </div>
        <div class="wlm-table-content">
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <!-- <el-table-column type="selection" width="55">
                </el-table-column> -->
                <el-table-column label="菜单名称">
                    <template slot-scope="scope">
                        <span>{{scope.row.title}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="状态">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.status == 1" type="success">已生效</el-tag>
                        <el-tag v-if="scope.row.status == 0" type="danger">未生效</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <div class="operation-group">
                            <router-link class="wlm-text" tag="span" :to="{path:'/channel/weChatMenuChannelAdd', query :{ id:scope.row.id}}">
                                <el-button type="text">编辑</el-button>
                            </router-link>
                            <div class="btn-line"></div>
                            <el-button class="wlm-text" type="text" @click="delTableItem(scope.row.id)">删除</el-button>
                            <div class="btn-line"></div>
                            <el-button class="wlm-text" type="text" @click="changeTableItem({id:scope.row.id,status:scope.row.status == 1 ? 0 : 1},tableFormatData.userTable.change.open,{isWarning: scope.row.status == 0,warning:'是否确认开启？',cancel:{msg:'已取消',val:{scope:scope,cancelStatus:{key:'status',val:0}}}})">
                                <span>使生效</span>
                            </el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</div>
</template>

<script>
import {
  getMenuList,
  menuDelete,
  uploadMenu2Wechat
} from '@/api/channel'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'WeChatMenuChannelList',
  components: {
  },
  data() {
    return {
      blogTitle: '',
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          api: {
            getList: getMenuList,
            delList: menuDelete
            //   msgConfig: {
            //     del: {
            //       type: 'warning',
            //       msg: '此操作会删除用户的所有数据，名下所有平台内如有正在交易的订单、金额，删除后所产生的纠纷由服务商自身承担 如要删除请慎重操作！！'
            //     }
            //   }
          },
          noPages: true,
          tableData: [],
          files: {

          },
          change: {
            open: {
              key: 'open',
              api: uploadMenu2Wechat
            }
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  },
  methods: {
  }
}
</script>
